package org.example.constans;

/**
 * @author WN
 * @date：2024/03/25 10:30
 */
public enum GlobalErrorCodeConstants {

    SUCCESS(200, "成功"),

    FAIL(-1, "失败"),

    BAD_REQUEST(400, "请求参数错误"),

    UNAUTHORIZED(401, "请求未授权"),

    NOT_FOUND(404, "请求路径不存在"),

    METHOD_NOT_ALLOWED(405, "请求方法不支持"),

    INTERNAL_SERVER_ERROR(500, "服务器内部异常"),

    SERVICE_UNAVAILABLE(503, "服务不可用");

    private Integer code;

    private String msg;

    private GlobalErrorCodeConstants(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getMsg() {
        return this.msg;
    }

    public Integer getCode() {
        return this.code;
    }

    public GlobalErrorCodeConstants setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public GlobalErrorCodeConstants setCode(Integer code) {
        this.code = code;
        return this;
    }

}
